<?php
	if(QUERY_STRING && !isset($userid) && !isset($username)) $userid = intval(QUERY_STRING);
	if(!$forward) $forward = HTTP_REFERER;
	
	if(!$_userid){
		showmessage("您还没有登录，请先登录",url("?module=member&action=login"));
	}
	
	switch ($action)
	{
	
		case 'add':
			
			if($db->select("select * from ".DB_PRE."member_fans where userid = $userid and fansid = $_userid")){
				showmessage("你已经是粉丝了",$forward);
			}
			else{
				if($db->insert(DB_PRE."member_fans",array('userid'=>$userid,'fansid'=>$_userid))){
					showmessage("添加成功",$forward);
				}
			}
			
		break;
		
		case 'cancel':
		
		break;
		default:
		
		break;	
	}
?>